package com.wind.demo.btrace;

import com.sun.btrace.BTraceUtils;
import com.sun.btrace.annotations.*;
import com.wind.demo.User;

import java.lang.reflect.Field;

/**
 * @Description:
 * @author: jishengping
 * @Date: 2019-10-20
 * @Time: 下午12:57
 */

@BTrace
public class PrintArgComplex {


    @OnMethod(
            clazz="com.wind.demo.Btracecontroller",
            method="arg2",
            location=@Location(Kind.ENTRY)
    )
    public static void anyRead(@ProbeClassName String pcn, @ProbeMethodName String pmn, User user) {
        //print all fields
        BTraceUtils.printFields(user);
        //print one field
        Field filed2 = BTraceUtils.field("com.wind.demo.User", "name");
        BTraceUtils.println(BTraceUtils.get(filed2, user));
        BTraceUtils.println(pcn+","+pmn);
        BTraceUtils.println();
    }
}


